<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<input type="text" id="score">
<input type="button" id="btn" value="评判">
<div id="output"></div>
<script>
    var scoreObj = document.getElementById('score'); //文本框对象
    var btn = document.getElementById('btn');         //按钮对象
    var output = document.getElementById('output');         //输出对象
    btn.onclick = function () {
        var score = scoreObj.value; //取得文本框的值
        var s = '';



        score = Number(score); //parseInt 12px 12  Number 12px NaN  +score 12px NaN
        score = Math.floor(score);
        console.log(score);
        switch  (score){
            case 10:
            case 9:
                s = '优秀';
                break;
            case 8:
                s = '良好';
                break;
            default :
                s = '不及格'

        }
        console.log(s);




        output.innerHTML = s;
    }

</script>
</body>
</html>